package com.menggudf.controller;

import com.menggudf.model.InvitationModel;
import com.menggudf.model.ResultModel;
import com.menggudf.model.ResultStatus;
import com.menggudf.model.UserModel;
import com.menggudf.service.InvitationService;
import com.menggudf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.Map;

/**
 * 手机端用户controller
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/invitation")
public class InvitationController {
	
	@Autowired
    InvitationService invitationService;
	
	   /**
     * 获取用户列表
     * @return
     */
    @RequestMapping("/getInvitationList")
    @ResponseBody
    public Map<String, Object> getInvitationList(
            @RequestParam(value="userCode",required=false) String userCode,
            @RequestParam(value="userName",required=false) String userName,
            @RequestParam("limit") int pageSize,
            @RequestParam("offset") int offset,
            @RequestParam("startTime") Date startTime,
            @RequestParam("endTime") Date endTime){
                return invitationService.getInvitationList(userCode,userName,pageSize,offset,startTime,endTime);
        
    }
    
    @RequestMapping("/getInvitationDetail")
    @ResponseBody
    public InvitationModel getUserDetail(
            @RequestParam(value="userCode",required=false) String userCode){
                return invitationService.getInvitationDetail(userCode);
        
    }

    @RequestMapping("/addInvitation")
    @ResponseBody
    public ResultModel addInvitation(@RequestParam(value="userName",required=false) String userName){
        return invitationService.addInvitation(userName);

    }
}
